(global.webpackJsonp = global.webpackJsonp || []).push([ [ "xg_o2o/getaddress/editaddr" ], {
    "00a2": function(e, t, a) {
        "use strict";
        a.r(t);
        var d = a("c4c8"), n = a("ecb5");
        for (var s in n) "default" !== s && function(e) {
            a.d(t, e, function() {
                return n[e];
            });
        }(s);
        var i = a("f0c5"), o = Object(i.a)(n.default, d.b, d.c, !1, null, null, null, !1, d.a, void 0);
        t.default = o.exports;
    },
    "24a5": function(e, t, a) {
        "use strict";
        (function(e) {
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.default = void 0;
            var a = {
                data: function() {
                    return {
                        bgColor: "",
                        textColor: "",
                        graceFullLoading: !0,
                        title: "地址编辑",
                        addrid: 0,
                        addressData: {},
                        addrprovince: 0,
                        mapaddress: "",
                        mapname: "",
                        citylatlng: "",
                        userWxInfo: {},
                        mobile: "",
                        showBack: !1
                    };
                },
                onLoad: function(e) {
                    var t = this, a = getCurrentPages();
                    this.showBack = a.length > 1;
                    var d = e.op;
                    if (e.addrid) {
                        this.addrid = e.addrid;
                        var n = this.$xSign.sign("v4address");
                        this.$xRequest.request({
                            url: "entry/wxapp/v4address",
                            data: {
                                op: d,
                                addrid: this.addrid,
                                xgsign: n
                            },
                            success: function(e) {
                                t.graceFullLoading = !1;
                                var a = JSON.parse(t.$Decrypt(e.data.data));
                                t.bgColor = a.bgColor, t.textColor = a.textColor, 0 == e.data.errno && a.addrid > 0 ? (t.addressData = a.addr, 
                                t.mapaddress = t.addressData.province, t.mapname = t.addressData.district, t.citylatlng = t.addressData.city, 
                                t.mobile = t.addressData.mobile, null == t.mapaddress && "" == t.mapaddress && void 0 === t.mapaddress || (t.addrprovince = 1)) : t.title = "新增地址";
                            }
                        });
                    } else this.graceFullLoading = !1;
                },
                methods: {
                    decryptPhoneNumber: function(t) {
                        var a = this;
                        if (e.getSystemInfoSync().platform != this.q7) if (t.detail.encryptedData && t.detail.iv) {
                            var d = this.$xSign.sign("v4getopenid");
                            this.$xRequest.request({
                                url: "entry/wxapp/v4getopenid",
                                data: {
                                    encryptedData: t.detail.encryptedData,
                                    iv: t.detail.iv,
                                    xgsign: d,
                                    op: "getphone"
                                },
                                success: function(e) {
                                    a.addressData.mobile = e.data.data.purePhoneNumber, a.mobile = e.data.data.purePhoneNumber;
                                },
                                fail: function(t) {
                                    e.showToast({
                                        title: "获取失败，请重试或者手动填写",
                                        icon: "none",
                                        mask: !0
                                    }), a.$xRequest.login();
                                }
                            });
                        } else e.showToast({
                            title: "获取失败，请重试或者手动填写!",
                            icon: "none",
                            mask: !0
                        }), this.$xRequest.login();
                    },
                    switchChange: function(e) {
                        this.addressData.isdefault = 1 == e.detail.value ? 1 : 0;
                    },
                    chooseLocation: function() {
                        var t = this;
                        e.getSetting({
                            success: function(a) {
                                0 == a.authSetting["scope.userLocation"] ? e.openSetting({
                                    success: function(a) {
                                        1 == a.authSetting["scope.userLocation"] ? (console.log("重新地址授权"), e.chooseLocation({
                                            success: function(e) {
                                                t.mapaddress = e.address, t.mapname = e.name, t.addrprovince = 1, t.citylatlng = e.latitude + "," + e.longitude;
                                            }
                                        })) : e.showModal({
                                            title: "提示",
                                            content: "请允许使用位置权限",
                                            success: function(e) {
                                                e.confirm ? t.chooseLocation() : e.cancel && console.log("用户点击取消");
                                            }
                                        });
                                    }
                                }) : e.chooseLocation({
                                    success: function(e) {
                                        t.mapaddress = e.address, t.mapname = e.name, t.addrprovince = 1, t.citylatlng = e.latitude + "," + e.longitude;
                                    }
                                });
                            }
                        });
                    },
                    delAddr: function() {
                        var t = this;
                        this.$xRequest.request({
                            url: "entry/wxapp/wx_address",
                            data: {
                                op: "del",
                                addrid: this.addrid
                            },
                            success: function(a) {
                                var d = a.data;
                                0 == d.errno && (e.showToast({
                                    title: d.message,
                                    icon: "none",
                                    duration: 800
                                }), t.$xRequest.navigateBack({
                                    data: {},
                                    delta: 2
                                }));
                            }
                        });
                    },
                    confirm: function() {
                        var t = this;
                        this.addressData.mobile = this.mobile;
                        var a = this.addressData;
                        if (a.username) if (/(^1[3|4|5|6|7|8|9][0-9]{9}$)/.test(a.mobile)) if (this.mapaddress) if (a.address) {
                            0 == a.isdefault || a.isdefault && void 0 !== a.isdefault || (a.isdefault = 1);
                            var d = this.$xSign.sign("v4address");
                            this.$xRequest.request({
                                url: "entry/wxapp/v4address",
                                data: {
                                    op: "submit",
                                    addrid: this.addrid,
                                    name: a.username,
                                    tel: a.mobile,
                                    address: a.address,
                                    isdefault: a.isdefault,
                                    province: this.mapaddress,
                                    district: this.mapname,
                                    xgsign: d,
                                    city: this.citylatlng
                                },
                                success: function(a) {
                                    var d = JSON.parse(t.$Decrypt(a.data.data));
                                    0 == a.data.errno && d.addrid > 0 && (e.$emit("selectAddr", {
                                        addrid: d.addrid,
                                        addressDetail: d.address
                                    }), e.navigateBack({
                                        delta: 2
                                    }));
                                }
                            });
                        } else e.showToast({
                            title: "请填写门牌号信息",
                            icon: "none",
                            duration: 800
                        }); else e.showToast({
                            title: "请在地图选择所在位置",
                            icon: "none",
                            duration: 800
                        }); else e.showToast({
                            title: "请输入正确的手机号码",
                            icon: "none",
                            duration: 800
                        }); else e.showToast({
                            title: "请填写联系人姓名",
                            icon: "none",
                            duration: 800
                        });
                    }
                }
            };
            t.default = a;
        }).call(this, a("543d").default);
    },
    c4c8: function(e, t, a) {
        "use strict";
        a.d(t, "b", function() {
            return n;
        }), a.d(t, "c", function() {
            return s;
        }), a.d(t, "a", function() {
            return d;
        });
        var d = {
            gracePage: function() {
                return a.e("graceUI/components/gracePage").then(a.bind(null, "1915"));
            },
            graceFullLoading: function() {
                return a.e("graceUI/components/graceFullLoading").then(a.bind(null, "7669"));
            },
            divider: function() {
                return a.e("components/divider/divider").then(a.bind(null, "bdb7"));
            }
        }, n = function() {
            this.$createElement, this._self._c;
        }, s = [];
    },
    dd4c: function(e, t, a) {
        "use strict";
        (function(e) {
            function t(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }
            a("4e1e"), t(a("66fd")), e(t(a("00a2")).default);
        }).call(this, a("543d").createPage);
    },
    ecb5: function(e, t, a) {
        "use strict";
        a.r(t);
        var d = a("24a5"), n = a.n(d);
        for (var s in d) "default" !== s && function(e) {
            a.d(t, e, function() {
                return d[e];
            });
        }(s);
        t.default = n.a;
    }
}, [ [ "dd4c", "common/runtime", "common/vendor" ] ] ]);